package com.sykj.cloud.activity.service.impl;

import com.sykj.cloud.activity.domain.ActivityInfo;
import com.sykj.cloud.activity.mapper.ActivityInfoMapper;
import com.sykj.cloud.activity.service.IActivityInfoService;
import com.sykj.cloud.common.core.utils.DateUtils;
import com.sykj.cloud.common.core.utils.IdUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 活动信息Service业务层处理
 *
 * @author mr.will
 * @date 2021-04-01
 */
@Service
public class ActivityInfoServiceImpl implements IActivityInfoService
{
    @Autowired
    private ActivityInfoMapper activityInfoMapper;

    /**
     * 新增活动信息
     *
     * @param activityInfo 活动信息
     * @return 结果
     */
    @Override
    public int insertActivityInfo(ActivityInfo activityInfo)
    {
        activityInfo.setGuid(IdUtils.fastSimpleUUID());
        activityInfo.setCreateTime(DateUtils.getNowDate());
        return activityInfoMapper.insertActivityInfo(activityInfo);
    }

    /**
     * 修改活动信息
     *
     * @param activityInfo 活动信息
     * @return 结果
     */
    @Override
    public int updateActivityInfo(ActivityInfo activityInfo)
    {
        activityInfo.setUpdateTime(DateUtils.getNowDate());
        return activityInfoMapper.updateActivityInfo(activityInfo);
    }

    /**
     * 批量删除活动信息
     *
     * @param guids 需要删除的活动信息ID
     * @return 结果
     */
    @Override
    public int deleteActivityInfoByIds(String[] guids)
    {
        return activityInfoMapper.deleteActivityInfoByIds(guids);
    }

    /**
     * 删除活动信息信息
     *
     * @param guid 活动信息ID
     * @return 结果
     */
    @Override
    public int deleteActivityInfoById(String guid)
    {
        return activityInfoMapper.deleteActivityInfoById(guid);
    }

    /**
     * 查询活动信息
     *
     * @param guid 活动信息ID
     * @return 活动信息
     */
    @Override
    public ActivityInfo getActivityInfoById(String guid)
    {
        return activityInfoMapper.getActivityInfoById(guid);
    }

    /**
     * 查询活动信息列表
     *
     * @param activityInfo 活动信息
     * @return 活动信息
     */
    @Override
    public List<ActivityInfo> listActivityInfos(ActivityInfo activityInfo)
    {
        return activityInfoMapper.listActivityInfos(activityInfo);
    }
}
